<template>
    
        <div class="tarbaritem" @click="pathClick">
            <div v-if="!isActive"><slot name="left"></slot></div>
            <div v-else><slot name="center"></slot></div>
            <div><slot name="right"></slot></div>
                
        </div>
            
   
    
</template>

<script>
export default {
  data(){
      return{
         
      }
      
  },
  props:{
      path:{
          type:String
      }
  },
  methods:{
      pathClick(){
          this.$router.push(this.path)
      }
  },
  computed:{
      isActive(){
         return this.$route.path.indexOf(this.path)!==-1
      }
  }
}
</script>

<style>
    .tarbaritem{
            flex:1;
            
        }
    .tarbaritem img{
            width: 24px;
            height: 24px;
        }
    </style>